package com.ctshk.rpc.scenic.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.scenic.dto.TicketTypeLuckDrawNumDTO;
import com.ctshk.rpc.scenic.entity.TicketLuckDrawApplyUserInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 门票抽奖用户报名信息表 Mapper 接口
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-02-18
 */
public interface TicketLuckDrawApplyUserInfoMapper extends BaseMapper<TicketLuckDrawApplyUserInfo> {

    @Select("<script>SELECT \n" +
            "t.session_code sessionCode,\n" +
            "t.discipline discipline,\n" +
            "t.sessions_name sessionName,\n" +
            "t.competition_area competitionArea,\n" +
            "t.competition_date competitionDate,\n" +
            "t.competition_time competitionTime,\n" +
            "t.fare_basis fareBasis,\n" +
            "t.price price,\n" +
            "tu.number number\n" +
            "FROM\n" +
            "t_ticket_type_luck_draw t\n" +
            "LEFT JOIN t_ticket_type_luck_draw_user tu\n" +
            "on t.id = tu.ticket_type_id \n" +
            "LEFT JOIN t_ticket_luck_draw_apply_user_info u\n" +
            "on tu.ticket_type_id = u.id\n" +
            "WHERE u.query_number = #{queryNumber}</script>")
    TicketTypeLuckDrawNumDTO selectTicketByQueryNumber(@Param("queryNumber")String queryNumber);
}
